home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 November / november_2001.iso / Browsers / Netscape 6.1 / browser.xpi / bin / chrome / comm.jar / content / wallet / walletTasksOverlay.xul < prev   
Encoding:
Extensible Markup Language  |  2001-07-10  |  8.4 KB  |  230 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    The contents of this file are subject to the Netscape Public
  5.    License Version 1.1 (the "License"); you may not use this file
  6.    except in compliance with the License. You may obtain a copy of
  7.    the License at http://www.mozilla.org/NPL/
  8.     
  9.    Software distributed under the License is distributed on an "AS
  10.    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    implied. See the License for the specific language governing
  12.    rights and limitations under the License.
  13.     
  14.    The Original Code is Mozilla Communicator client code, released
  15.    March 31, 1998.
  16.    
  17.    The Initial Developer of the Original Code is Netscape
  18.    Communications Corporation. Portions created by Netscape are
  19.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  20.    Rights Reserved.
  21.    
  22.    Contributor(s): 
  23.   -->
  24.  
  25. <!DOCTYPE window SYSTEM "chrome://wallet/locale/walletTasksOverlay.dtd">
  26.  
  27. <overlay id="walletTasksOverlay"
  28.          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  29.  
  30.   <script type="application/x-javascript" src="chrome://wallet/content/walletOverlay.js"/>
  31.  
  32.   <script type="application/x-javascript">
  33.   <![CDATA[
  34.  
  35.     function HideWallet() {
  36.       var element;
  37.       element = document.getElementById("wallet");
  38.       element.setAttribute("style","display: none;" );
  39.       element.setAttribute("disabled","true" );
  40.     }
  41.  
  42.     function CheckForEncrypt() {
  43.       // remove either encrypt or obscure depending on pref setting
  44.       var elementOn, elementOff;
  45.       try {
  46.         if (this.pref.GetBoolPref("wallet.crypto")) {
  47.           elementOn = document.getElementById("obscure");
  48.           elementOff = document.getElementById("encrypt");
  49.   } else {
  50.           elementOn = document.getElementById("encrypt");
  51.           elementOff = document.getElementById("obscure");
  52.   }
  53.         elementOn.setAttribute("disabled","false");
  54.         elementOff.setAttribute("disabled","true");
  55.       }
  56.       catch(e) {
  57.         var encrypt = document.getElementById("encrypt");
  58.           if(encrypt) {
  59.             encrypt.setAttribute("disabled", "true");
  60.           }
  61.           var obscure = document.getElementById("obscure");
  62.           if(obscure) {
  63.             obscure.setAttribute("disabled", "true");
  64.           }
  65.           dump("wallet.crypto pref is missing from all.js\n");
  66.       }
  67.     }
  68.  
  69.     function CheckForWallet() {
  70.       // remove wallet functions if not in browser
  71.       try {
  72.         if (!appCore) {
  73.           HideWallet();
  74.         }
  75.       } catch(e) {
  76.         HideWallet();
  77.       }
  78.     }
  79.  
  80.     // perform a wallet action
  81.     function WalletAction( action ) {
  82.       var wallet = Components.classes['@mozilla.org/wallet/wallet-service;1'];
  83.       wallet = wallet.getService();
  84.       wallet = wallet.QueryInterface(Components.interfaces.nsIWalletService);
  85.       var strings = document.getElementById("personalManagers");
  86.  
  87.       switch( action ) {
  88.         case "password":
  89.           if (!wallet.WALLET_ChangePassword()) {
  90.             window.alert(strings.getAttribute("PasswordNotChanged"));
  91.           }
  92.           break;
  93.         case "expire":
  94.           if (wallet.WALLET_ExpirePassword()) {
  95.             window.alert(strings.getAttribute("PasswordExpired"));
  96.           } else {
  97.             window.alert(strings.getAttribute("PasswordNotExpired"));
  98.           }
  99.           break;
  100.         case "clear":
  101.           if (window.confirm(strings.getAttribute("AllDataWillBeCleared"))) {
  102.             wallet.WALLET_DeleteAll();
  103.           }
  104.           break;
  105.         case "encrypt":
  106.           wallet.WALLET_InitReencryptCallback(window._content);
  107.           this.pref.SetBoolPref("wallet.crypto", true);
  108.           break;
  109.         case "obscure":
  110.           wallet.WALLET_InitReencryptCallback(window._content);
  111.           this.pref.SetBoolPref("wallet.crypto", false);
  112.           break;
  113. /*
  114.         case "safefill":
  115.           formPrefill();
  116.           break;
  117.         case "quickfill": 
  118.           formQuickPrefill();
  119.           break;
  120.         case "capture":
  121.           formCapture();
  122.           walletService.WALLET_RequestToCapture(window._content);
  123.           break;
  124. */
  125.         default:
  126.           break;
  127.       }
  128.     }  
  129.  
  130.     // display a Wallet Dialog
  131.     function WalletDialog(which) {
  132.       switch( which ) {
  133.         case "signon":
  134.           window.openDialog("chrome://communicator/content/wallet/SignonViewer.xul",
  135.                             "SSViewer","modal=yes,chrome,resizable=yes","S"); 
  136.           break;
  137.         case "samples":
  138.           window._content.location.href = 'chrome://communicator/locale/wallet/index.html';
  139.           break;
  140.         case "walletsites":
  141.           window.openDialog("chrome://communicator/content/wallet/SignonViewer.xul",
  142.                             "SSViewer","modal=yes,chrome,resizable=no","W"); 
  143.           break;
  144.         case "wallet":
  145.         default:
  146.           formShow();
  147.           break;
  148.       }
  149.     }
  150.  
  151.   ]]>
  152.   </script>         
  153.  
  154.   <!-- tasksOverlay menu items -->
  155.   <menupopup  id="personalManagers"
  156.               PasswordNotChanged = "&PasswordNotChanged;"
  157.               PasswordExpired = "&PasswordExpired;"
  158.               PasswordNotExpired = "&PasswordNotExpired;"
  159.               AllDataWillBeCleared = "&AllDataWillBeCleared;"
  160.               UnableToCapture = "&UnableToCapture;"
  161.               Captured = "&Captured;"
  162.               NotCaptured = "&NotCaptured;"
  163.               noPrefills = "&noPrefills;"
  164.               oncreate="CheckForWallet()"> 
  165.     <menu label="&walletPasswordManager.label;"
  166.           accesskey="&walletPasswordManager.accesskey;"
  167.           position="1">
  168.       <menupopup oncreate="CheckForEncrypt()">
  169.         <menuitem label="&walletDisplaySignonsCmd.label;"
  170.                   accesskey="&walletDisplaySignonsCmd.accesskey;"
  171.                   oncommand="WalletDialog('signon');"/> 
  172.         <menuitem label="&walletChangePasswordCmd.label;"
  173.                   accesskey="&walletChangePasswordCmd.accesskey;"
  174.                   oncommand="WalletAction('password');"/>
  175.         <menuitem label="&walletExpirePasswordCmd.label;"
  176.                   accesskey="&walletExpirePasswordCmd.accesskey;"
  177.                   oncommand="WalletAction('expire');"/>
  178.         <menuseparator/>
  179.         <menuitem label="&walletEncryptCmd.label;"
  180.                   id="encrypt"
  181.                   accesskey="&walletEncryptCmd.accesskey;" 
  182.                   oncommand="WalletAction('encrypt');"/>
  183.         <menuitem label="&walletObscureCmd.label;"
  184.                   id="obscure"
  185.                   accesskey="&walletObscureCmd.accesskey;" 
  186.                   oncommand="WalletAction('obscure');"/>
  187.         <menuitem label="&walletClearCmd.label;"
  188.                   id="clear"
  189.                   accesskey="&walletClearCmd.accesskey;" 
  190.                   oncommand="WalletAction('clear');"/>
  191.       </menupopup>
  192.     </menu>
  193.     <menu label="&walletFormManager.label;"
  194.           accesskey="&walletFormManager.accesskey;"
  195.           id="wallet"
  196.           position="2">
  197.       <menupopup>
  198.         <menuitem label="&walletContentsCmd.label;"
  199.                   accesskey="&walletContentsCmd.accesskey;"
  200.                   id="walleteditor"
  201.                   oncommand="WalletDialog('wallet');"/> 
  202.         <menuitem label="&walletSitesCmd.label;"
  203.                   accesskey="&walletSitesCmd.accesskey;"
  204.                   id="walletsites"
  205.                   oncommand="WalletDialog('walletsites');"/> 
  206. <!--        
  207.     <menuseparator/>
  208.         <menuitem label="&walletSafeFillCmd.label;"
  209.                   accesskey="&walletSafeFillCmd.accesskey;"
  210.                   id="walletSafeFill"
  211.                   oncommand="WalletAction('safefill');"/> 
  212.         <menuitem label="&walletQuickFillCmd.label;"
  213.                   accesskey="&walletQuickFillCmd.accesskey;"
  214.                   id="walletQuickFill"
  215.                   oncommand="WalletAction('quickfill');"/> 
  216.         <menuitem label="&walletRequestToCaptureCmd.label;"
  217.                   accesskey="&walletRequestToCaptureCmd.accesskey;"
  218.                   id="walletCapture"
  219.                   oncommand="WalletAction('capture');"/> 
  220.         <menuseparator/>
  221.         <menuitem label="&walletSamplesCmd.label;"
  222.                   accesskey="&walletSamplesCmd.accesskey;"
  223.                   id="walletSamples"
  224.                   oncommand="WalletDialog('samples');"/> 
  225. -->
  226.       </menupopup>
  227.     </menu>
  228.   </menupopup>
  229. </overlay>
  230.